import { hasPermission } from '@/directives/permission/hasPermi'

interface CalculateCellWidthOptions {
  permission: string
  width: number
}

export const CalculateCellWidth = (options: CalculateCellWidthOptions[] = []) => {
  let _width = 0
  options.forEach((item) => {
    const { permission, width } = item
    hasPermission(permission) && (_width += width)
  })
  return _width
}
